package org.xteam.box2text.old;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * SL is used to handle separated list (ie. { X Sep }* or {X Sep }+)
 * 
 * SL op=OP [ BOX1 BOX2 ... ] is an abbreviation for G gs=4 op=OP [ BOX1 BOX2 ... ]
 * 
 * @author llhours
 * 6 mai 08
 * $Id$
 */
public class SLOperator extends Operator {
	
	// XXX use 2 instead of 4 because we don't handle implicit separators 
	private static final int SIZE = 2;

	public SLOperator(int op, Box... boxes) {
		this(op, Arrays.asList(boxes));
	}
	
	public SLOperator(int op, List<Box> boxes) {
		super(boxes);
		options.put("op", op);
	}

	public List<Box> normalizeGroups(boolean splice) {
		Map<String, Integer> options = new HashMap<String, Integer>(this.options);
		options.put("gs", SIZE);
		return new GOperator(options, arguments).normalizeGroups(splice);
	}

}
